package com.jiaquyun.jcps.mode.manager

import com.jiaquyun.jcps.entity.UserInfoResponse
import com.jiaquyun.jcps.mode.BaseManager
import com.jiaquyun.jcps.mode.api.AccessApi
import com.lemlin.network.HttpServiceData
import com.lemlin.network.HttpServiceManager
import com.lemlin.network.HttpServiceSubscribe
import com.lemlin.network.SubscribeListener
import io.reactivex.disposables.Disposable
import retrofit2.http.Field

class AccessManager : HttpServiceManager<AccessApi>(AccessApi::class.java) {

    /**
     * 手机号登录
     */
    fun mobileLogin(
        mobile: String, captcha: String, listener: SubscribeListener<UserInfoResponse>
    ): Disposable =
        subscribe(apiService.mobileLogin(mobile, captcha), HttpServiceSubscribe(listener))

    /**
     * 发送验证码
     */
    fun smsSend(
        mobile: String, listener: SubscribeListener<HttpServiceData>
    ): Disposable =
        subscribe(apiService.smsSend(mobile), HttpServiceSubscribe(listener))

}